package com.wdb.common.configurer.feign;

import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import org.springframework.context.annotation.Bean;

/**
 * support feign for spring multipart,must add these dependencies
 * <p>
 * <dependency>
 * <groupId>io.github.openfeign.form</groupId>
 * <artifactId>feign-form</artifactId>
 * </dependency>
 * <dependency>
 * <groupId>io.github.openfeign.form</groupId>
 * <artifactId>feign-form-spring</artifactId>
 * </dependency>
 * <p>
 * if enabled hystrix,these properties should be consider
 * <p>
 * hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds
 * hystrix.command.default.execution.timeout.enabled
 */
public class FeignMultipartSupport {

    @Bean
    public Encoder feignFormEncoder() {
        return new SpringFormEncoder();
    }

    @Bean
    public feign.Logger.Level multipartLoggerLevel() {
        return feign.Logger.Level.BASIC;
    }
}
